package com.woniu.controller;

import com.woniu.entity.Users;
import com.woniu.service.UserService;
import com.woniu.service.impl.UserServiceImpl;

import java.util.List;

public class UserController {
    public static Users userLogin(String username, String pwd) {
      UserService serviceUserLogin = new UserServiceImpl();
        Users users = serviceUserLogin.serviceUserLogin(username, pwd);
        return users;

    }
    public static void updateUserMoney(Integer uid, Double price) {
        UserService serviceUserUpdate = new UserServiceImpl();
        serviceUserUpdate.updateUsersMoney(uid, price);
    }
    public static void insertUser(Users users){
        UserService serviceUserInsert = new UserServiceImpl();
        serviceUserInsert.insertUser(users);
    };
    public static Users selectUserByName(String username){
        UserService serviceUserSelect = new UserServiceImpl();
        return serviceUserSelect.selectUserByName(username);
    }
    public static List<Users> selectAllUsersByPowerId(Integer power_id){
        UserService serviceUserSelect = new UserServiceImpl();
        return serviceUserSelect.selectAllUsersByPowerId(power_id);
    };
    public static void deleteUserById(Integer uid){
        UserService serviceUserDelete = new UserServiceImpl();
        serviceUserDelete.deleteUserById(uid);
    };
    public static Users selectUserByUid(int userId){
        UserService serviceUserSelect = new UserServiceImpl();
        return serviceUserSelect.selectUserByUid(userId);
    };
    public static void updateUserName(String username,Integer uid){
        UserService serviceUserUpdate = new UserServiceImpl();
        serviceUserUpdate.updateUserName(username,uid);
    }
    public static void updateUserPwd(String pwd,Integer uid){
        UserService serviceUserUpdate = new UserServiceImpl();
        serviceUserUpdate.updateUserPwd(pwd,uid);
    }
    public static void updateUserTelphone(String telphone,Integer uid){
        UserService serviceUserUpdate = new UserServiceImpl();
        serviceUserUpdate.updateUserTelphone(telphone,uid);
    }
}
